<template>
  <el-dialog
    :title="title"
    :visible.sync="open"
    width="600px"
    append-to-body
    :close-on-click-modal="false"
    @close="closeModal"
  >
    <el-form ref="form" :model="form" :show-message="false" label-width="150px">
      <el-form-item label="用法名称" prop="name" required>
        <el-input
          v-model="form.name"
          placeholder="请输入用法名称"
          :maxlength="30"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item label="处方类型" prop="name">
        <el-input
          type="textarea"
          :rows="3"
          placeholder="请输入分组说明"
          v-model="form.note"
        >
        </el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="open = false">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      title: "新建用法",
      open: false,
      form: {
        ids: undefined,
        name: undefined
      },
    };
  },
  methods: {
    openModal(ids) {
      this.open = true;
      this.form.ids = ids || undefined;
    },
    closeModal() {
      this.$refs["form"].resetFields();
      Object.assign(this.$data, this.$options.data()); // 存在自定义校验规则不能重置data
    },
    submitForm() {

    }
  }
}
</script>

<style lang="scss" scoped>
</style>
